SUBDIRS = . images

xauxdir = $(libdir)/iiim/le/unihan2
xaux_LTLIBRARIES = xaux_gnome.la

INCLUDES = 							\
	$(WARN_CFLAGS)						\
	-I$(top_srcdir)/common					\
	-I$(top_srcdir)/json-c					\
	-I$(top_srcdir)/include					\
	-DLOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"	\
	-DUNIHAN_DATA_DIR=\""$(pkgdatadir)"\"			\
	-DUNIHAN_XAUX_DIR=\""$(xauxdir)"\"	\
	-DBINDIR=\""$(bindir)"\"

xauxextdir = $(xauxdir)/gnome
xauxext_PROGRAMS = xaux_ext_lookup xaux_ext_status

xaux_gnome_la_SOURCES = unihan_xaux_so.c
xaux_gnome_la_LIBADD = ../common/libxaux_common.la
xaux_gnome_la_LDFLAGS = -module -avoid-version -ldl @XML_LDFLAGS@ -no-undefined

xaux_ext_lookup_SOURCES =	\
	../common/debug.c	\
	xaux_ext_lookup.c	\
	key_punc_images.h	\
	punc_keyboard.c		\
	punc_keyboard.h		\
	punc.c			\
	punc.h			\
	key_us_images.h		\
	us_keyboard.c		\
	us_keyboard.h		\
	us.c			\
	us.h			\
	imlabel.c		\
	imlabel.h		\
	gtkflatbutton.c		\
	gtkflatbutton.h

xaux_ext_lookup_CFLAGS = $(XAUX_LOOKUP_CFLAGS) -I..
xaux_ext_lookup_LDADD = ../common/libxaux_common.la \
			../common/libxaux_ext.la \
			../json-c/libjson.la \
			$(XAUX_LOOKUP_LIBS)

xaux_ext_status_SOURCES =	\
	../common/debug.c	\
	xaux_ext_status.c	\
	hwpenx_wrapper.c	\
	hwpenx_wrapper.h	\
	wtpen_wrapper.c		\
	setting.h		\
	setting.c		\
	Gconf_cb.h		\
	Gconf_cb.c		\
	propagate.h		\
	propagate.c		\
	global.h

xaux_ext_status_CFLAGS = $(XAUX_STATUS_CFLAGS)
xaux_ext_status_LDADD = ../common/libxaux_common.la \
			../common/libxaux_ext.la \
			$(XAUX_STATUS_LIBS)

if HAVE_LIBPANEL_APPLET
SOCKET_GNOME1 = unihan-socket-gnome1
endif

if MAKE_GNOME2_SOCKET
SOCKET_GNOME2 = unihan-socket-gnome2
endif

bin_PROGRAMS = $(SOCKET_GNOME1)
libexec_PROGRAMS = $(SOCKET_GNOME2)

unihan_socket_gnome1_SOURCES = socket_gnome1.c
unihan_socket_gnome1_CFLAGS = $(LIBPANEL_APPLET_CFLAGS)
unihan_socket_gnome1_LDFLAGS = $(LIBPANEL_APPLET_LIBS)

unihan_socket_gnome2_SOURCES = socket_gnome2.c
unihan_socket_gnome2_CFLAGS = $(XAUX_SOCKET_GNOME2_CFLAGS)
unihan_socket_gnome2_LDFLAGS = $(XAUX_SOCKET_GNOME2_LIBS)

socket_gnome1_gnorba_data = unihan_socket_gnome1.gnorba
if HAVE_LIBPANEL_APPLET
gnorbadir = $(sysconfdir)/CORBA/servers
gnorba_DATA = $(socket_gnome1_gnorba_data)
endif

desktop_in_files = unihan_socket_gnome1.desktop.in
desktop_in_in_files = $(desktop_in_files:.desktop.in=.desktop.in.in)
if HAVE_LIBPANEL_APPLET
desktopdir = $(datadir)/applets/Utility
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
endif
@INTLTOOL_DESKTOP_RULE@

%.desktop.in: %.desktop.in.in
	sed "s#Icon=#Icon=$(pkgdatadir)/images/#" $< > $@


server_in_files = Com_SW-Linux_Unihan.server.in
server_in_in_files = $(server_in_files:.server.in=.server.in.in)
if MAKE_GNOME2_SOCKET
serverdir = $(libdir)/bonobo/servers
server_DATA = $(server_in_files:.server.in=.server)
endif
@INTLTOOL_SERVER_RULE@

%.server.in: %.server.in.in
	sed "s#\@UNIHAN_ICONDIR\@#$(pkgdatadir)/images#" $< > $@

socket_gnome2_menuxml = socket_gnome2_menu.xml
menuxmldir = $(pkgdatadir)
menuxml_DATA = $(socket_gnome2_menuxml)

schemasdir = @GCONF_SCHEMA_FILE_DIR@
schemas_in_files = unihan.schemas.in
schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
@INTLTOOL_SCHEMAS_RULE@


EXTRA_DIST =					\
	$(desktop_in_in_files)			\
	$(schemas_in_files)			\
	$(server_in_in_files)			\
	$(socket_gnome2_menuxml)		\
	$(socket_gnome1_gnorba_data)

CLEANFILES = $(desktop_in_files) $(server_in_files)

install-data-local:
	if test -z "$(DESTDIR)"; then \
	for p in $(schemas_DATA); do \
		GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p; \
	done \
	fi
